package hk.linkcredit.awardservice.common.handler;

import hk.linkcredit.awardservice.common.constant.Status;
import hk.linkcredit.awardservice.utils.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * <p>
 * 统一异常处理
 * </p>
 *
 * @author yangkai.shen
 * @date Created in 2018-10-02 21:26
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e) {
        log.error(">>>【Exception】：{}", e.getMessage(), e);
        return Result.failure(Status.SYSTEM_BUSY);
    }

}
